﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Sockets;
using System.IO;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            TcpClient tcpClient = new TcpClient("127.0.0.1",2112);
            NetworkStream ns = tcpClient.GetStream();
            FileStream fs = File.Open(@"D:\c#总结\Tcp\WindowsFormsApp1\ConsoleApp1\App.config", FileMode.Open);
            int data = fs.ReadByte();

            while (data != -1)
            {
                ns.WriteByte((byte)data);
                data = fs.ReadByte();
            }

            fs.Close();
            ns.Close();
        }
    }
}
